#include <stdio.h>
#include <stdlib.h>
int main()
{
    int n,i,j,temp,a[100];
    FILE *fp,*ft;
    if((fp=fopen("b.txt","r"))==NULL)
    {
    	printf("Can not open the file.\n");
    	exit(0);
	}
	fscanf(fp,"%d",&n);
	for(i=0;i<n;i++)
	{
		fscanf(fp,"%d",&a[i]);
	}
	for(i=0;i<n-1;i++)
	{
		for(j=i+1;j<n;j++)
		{
			if(a[i]>a[j])
			{
				temp=a[i];
				a[i]=a[j];
				a[j]=temp;
			}			
		}
	}
	fclose(fp);
	if((ft=fopen("c.txt","w"))==NULL)
    {
    	printf("Can not open the file.\n");
    	exit(0);
	}
	for(i=0;i<n;i++)
	{
		fprintf(ft,"%6d",a[i]);
		if((i+1)%10==0)
		{
			fprintf(ft,"\n");
		}
	}
	fclose(ft);

    return 0;
}

